//
//  HQMapShowAreaOptionsModel.m
//  o_amap
//
//  Created by Q神 on 2021/4/14.
//

#import "HQMapShowAreaOptionsModel.h"

@implementation HQMapShowAreaOptionsModel

+ (NSDictionary *)mj_objectClassInArray {
    return @{@"latLngList": @"LatLngModel"};
}

- (void)setShowArea:(MAMapView *)mapView {
    double latitude = [[self.latLngList.firstObject latitude] floatValue];
    double longitude = [[self.latLngList.firstObject longitude] floatValue];
    double latitude1 = [[self.latLngList.lastObject latitude] floatValue];
    double longitude1 = [[self.latLngList.lastObject longitude] floatValue];
//    CLLocationCoordinate2D coord2D = CLLocationCoordinate2DMake(latitude, longitude);
    /// 显示范围精度
    MACoordinateSpan span;
    span.latitudeDelta = fabs(latitude - latitude1) * 1.4;
    span.longitudeDelta = fabs(longitude - longitude1) * 1.4;
    /// 显示区域
    MACoordinateRegion region = {mapView.centerCoordinate, span};
    /// 设置显示区域
    [mapView setRegion:region animated:YES];
}

@end
